feat(spec,parse): add repeatable clause groups - #1321
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
afb02b9 to
a3dcdce
Compare
a3dcdce to
bde9cf0
Compare
bde9cf0 to
77c2d44
Compare
77c2d44 to
664f277
Compare
5055214 to
14f6fc6
Compare
14f6fc6 to
ea0bc3a
Compare
936196b to
8b07e40
Compare
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes. Shadow comparisonParsing
|
6b00bd5 to
b908b50
Compare
b908b50 to
1b61021
Compare
d74267e to
f824fa6
Compare
f824fa6 to
715e8a5
Compare
00988bb to
7db6c6c
Compare
7db6c6c to
a9175f9
Compare
a9175f9 to
3100bf7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3100bf7. Configure here.
## Summary - add clause tables and boundary events to the zero-allocation argv parser - support typed Vec<T> clause fields through usage derive - add equivalent Go parser, spec-lowering, and generated-table support - extend the shared corpus so interpreted Rust, compiled Rust, and Go agree - report clause addition, removal, and separator changes as breaking in usage diff ## Stack - Depends on #1321 ## Test plan - mise run test - mise run lint - mise run render - mise run gen-shadow - cd go && go test ./... *AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.* <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes core positional parsing and completion cursor rules across Rust and Go; spec clause changes are intentionally breaking, but behavior is covered by new corpus and conformance tests. > > **Overview** > Adds **repeatable clause** support: a command can declare one separator-delimited positional group (e.g. `:::`) whose inner arguments reset on each boundary instead of overwriting the previous instance. > > The **argv parser** gains `Command.clause`, a `ClauseSeparator` event, and positional binding through the clause’s inner args (including after restart tokens and when automatic `--` stops flags). **Completions**, **help/usage**, and **spec emission** now treat clause positionals like ordinary args, with usage showing a repeatable `[separator …]…` pattern. > > **Derive** supports `#[usage(clause, separator = "…")]` on `Vec<T>` (`T: Args`) with partial/build/apply wiring; **Go** mirrors the same parser, help, spec lowering, and generated `Parse` structs. **Conformance** and a new corpus section expect a `clauses` map of per-instance arg bindings; **usage diff** marks clause add/remove/separator changes as breaking. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8703b56. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->

Summary
Stack
Test plan
AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.
Note
Medium Risk
Touches core argv parsing, completion heuristics, and relationship validation; behavior changes are broad but gated behind new spec syntax and covered by conformance tests.
Overview
Introduces clauses: repeatable positional groups separated by a token (e.g.
:::), with each instance stored inParseOutput.clausesinstead of overwriting likerestart_token.Spec & parser: New
clauseKDL node (min_usage_version6.6), mutually exclusive with top-level args,restart_token, and sigil args inside the clause. Parsing treats the separator as syntax (even afterdouble_dash="automatic"), resets positional/flag state per instance, honors explicit--for literal separators, skips env/defaults for clause args, and validates required/relationship rules per instance. Positional grammar routes throughactive_args()so clause inner args drive the cursor.Completion & docs: Shell completion treats a clause separator like a restart (first inner arg choices, flags re-enabled across instances). Adds reference docs, example spec, docs model field, and
MissingClauseArgerrors.Tests: Conformance suite for multi-instance values, double-dash behavior, negatives, KDL round-trip, and per-instance relationships; CLI completion tests for separator and default-subcommand paths.
Reviewed by Cursor Bugbot for commit af6ee72. Bugbot is set up for automated code reviews on this repo. Configure here.